]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ShellApp: Avoid crashing during state transition for window-backed apps
authorColin Walters <walters@verbum.org>
Tue, 23 Aug 2011 16:03:56 +0000 (12:03 -0400)
committerColin Walters <walters@verbum.org>
Wed, 24 Aug 2011 16:32:33 +0000 (12:32 -0400)
During a state transition from running to not-running for
window-backend apps, it's possible we get a request for the icon.
Avoid asserting here and just return an empty image.

https://bugzilla.gnome.org/show_bug.cgi?id=656546

src/shell-app.c

index a0bddeafed5398aff215b848fe159f3ccc72a2c8..75444b6551473af132f5b3c4f65e0b375fbb5e67 100644 (file)
@@ -133,8 +133,22 @@ static ClutterActor *
 window_backed_app_get_icon (ShellApp *app,
                             int       size)
 {
-  MetaWindow *window = window_backed_app_get_window (app);
-  ClutterActor *actor = st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
+  MetaWindow *window;
+  ClutterActor *actor;
+
+  /* During a state transition from running to not-running for
+   * window-backend apps, it's possible we get a request for the icon.
+   * Avoid asserting here and just return an empty image.
+   */
+  if (app->running_state == NULL)
+    {
+      actor = clutter_texture_new ();
+      g_object_set (actor, "opacity", 0, "width", (float) size, "height", (float) size, NULL);
+      return actor;
+    }
+
+  window = window_backed_app_get_window (app);
+  actor = st_texture_cache_bind_pixbuf_property (st_texture_cache_get_default (),
                                                                G_OBJECT (window),
                                                                "icon");
   g_object_set (actor, "width", (float) size, "height", (float) size, NULL);